(* RLC CIRCUIT *)

QRLC[t_] :=B (E^(-((Rr t)/(2 L)))) (Cosh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))]+(((Sqrt[c]) Rr Sinh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))])/(Sqrt[-4 L+c (Rr^2)])))

JRLC[t_] :=-(1/(2 L))B (E^(-((Rr t)/(2 L)))) Rr (Cosh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))]+(((Sqrt[c]) Rr Sinh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))])/(Sqrt[-4 L+c (Rr^2)])))+B (E^(-((Rr t)/(2 L)))) (((Rr Cosh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))])/(2 L))+((Sqrt[-4 L+c (Rr^2)]) Sinh[(((Sqrt[-4 L+c (Rr^2)]) t)/(2 (Sqrt[c]) L))])/(2 (Sqrt[c]) L))

c=0.0288; (*capcity*)
R=0.01 ; (*diode resistance*)
Rr = 0.06;(*main rlc circuit resistance*)
L=0.000196666; (*inductor*)
B = 450*c; (*initial charge*)
K = -21.6*c; (*forward drop*)

(* STARTING CURRENT "A" FOR RLC -> RLC WITH C-DIODE TRANSITION *)

tswitch = Re[t/.FindRoot[QRLC[t]-K, {t, 0.005}]]

A=JRLC[tswitch]

(* SOLVING *)
s=NDSolve[{Q1[t]/c - (Q2'[t]-Q1'[t])*R==0, (Q2'[t]-Q1'[t])*R + Rr*Q2'[t] + L*Q2''[t]==0, Q1[0]==K, Q2[0]==-K, Q2'[0]==A},{Q1,Q2},{t,0,0.03},MaxStepSize->0.0000001,MaxSteps->10^6]

J2[t_] = D[Q2[t],t]

(* Plotting the voltage across capacitor (Q1) and the current in inductor (J2) after the switching*)

Plot[Evaluate[{Q1[t]/c}/.s], {t,0,0.03}, PlotRange->All,PlotPoints->200]
Plot[Evaluate[{J2[t]}/.s], {t,0,0.03}, PlotRange->All,PlotPoints->200]

(* Complete functions and plots *)

Vgen[t_] := Piecewise[{{QRLC[t], t<tswitch}, {Q1[t-tswitch],t>tswitch}}]/c
Jgen[t_] := Piecewise[{{JRLC[t], t<tswitch}, {J2[t-tswitch],t>tswitch}}]

Plot[Evaluate[{Vgen[t]}/.s], {t,0,0.03}, PlotRange->{460,-125},  PlotPoints-> 200]
Plot[Evaluate[{Jgen[t]}/.s], {t,0,0.03}, PlotRange->{200,-3500},  PlotPoints-> 200]